<div class="section" *ngIf="project && task"><table style="width: 100%"><tr>
<td style="vertical-align: top; padding-right: 16px;">
  <p style="text-align: center"><strong>{{project.name}}的任务分解表</strong></p>
  <task-table project_id="{{project_id}}"></task-table>
</td>
<td style="vertical-align: top">
  <div class="field"><md-input-container>
    <input mdInput [disabled]="true" [value]="project.name"
      placeholder="任务所属项目名称" /></md-input-container></div>

  <div class="field"><md-select placeholder="任务所属阶段" *ngIf="stages"
        [disabled]="disabled" [(ngModel)]="task.stage_id" (change)="onStageChange()">
      <md-option *ngFor="let stage of stages" [value]="stage.id">{{stage.name}}</md-option>
    </md-select></div>

  <div class="field" *ngIf="task && task.stage"><md-input-container>
    <input placeholder="任务名称" mdInput [mdAutocomplete]="auto"
        [disabled]="disabled" [(ngModel)]="task.name" /></md-input-container>
    <md-autocomplete #auto="mdAutocomplete">
      <md-option *ngFor="let tip of task.stage.tips" [value]="tip">{{tip}}</md-option>
    </md-autocomplete></div>

  <div class="field"><md-input-container>
    <textarea mdInput [disabled]="disabled" (change)="changeDesc($event)"
        placeholder="任务描述">{{task.desc}}</textarea></md-input-container></div>

  <p><md-select [(ngModel)]="task.receiver_id" [disabled]="disabled"
        placeholder="任务接收人">
      <md-option *ngFor="let user of users" [value]="user.id">{{user.name}}</md-option>
    </md-select>

  <p><md-input-container>
    <input mdInput type="date" [(ngModel)]="task.s_date"
        [disabled]="disabled" placeholder="任务开始日期" /></md-input-container>

  <p><md-input-container>
    <input mdInput type="date" [(ngModel)]="task.e_date"
        [disabled]="disabled" placeholder="任务结束日期" /></md-input-container>

  <p><md-input-container>
    <input mdInput [(ngModel)]="task.hours" type="number"
        [disabled]="disabled" placeholder="任务工时" /></md-input-container>

  <p><md-input-container>
    <input mdInput [(ngModel)]="task.ot_hours" type="number"
        [disabled]="disabled" placeholder="任务加班工时" /></md-input-container>

  <p><button md-raised-button (click)="submit()"
    [disabled]="disabled || submitting">提交
    <i *ngIf="submitting" class="fa fa fa-spinner fa-pulse"></i></button></p>
</td>
</tr></table></div>
